<?php
/**
 * @package qBase
 * @subpackage model
 *
 */

/**
 * Represents an QIData abstract data
 * 
 * @package qBase
 * @subpackage model
 */
interface QIData
{
	/**
	 * Gets the storage that this object should work with
	 *
	 * @return QStorage
	 */
	public function getStorage();
	/**
	 * Sets the storage that this object should work with
	 *
	 * @param QStorage $storage
	 */
	public function setStorage(QStorage $storage);
	/**
	 * Gets the storage id if any was set
	 *
	 * @return QStorageId
	 */
	public function getStorageId();
	/**
	 * Sets the storage id for the object
	 *
	 * @param QStorageId $id
	 */
	public function setStorageId(QStorageId $id);
	/**
	 * Unsets the storage id if any
	 *
	 * @return boolean Returns true if a storage id existed
	 */
	public function unsetStorageId();
	/**
	 * Gets the list of properties that will interact with the storage
	 *
	 * @return array Array of string
	 */
	public function getStorageProperties();
	/**
	 * Gets the list of properties that will be loaded by default when the object is loaded by the storage
	 * If a property is a reference if will be also loaded, the process will be recursive 
	 * If a property is an array/collection it will be loaded, the process will be recursive 
	 *
	 * @return array Array of strings
	 */
	public function getDefaultLoadProperties();
	/**
	 * Gets the property with the specified name
	 * The storage will always call this function to get a property
	 * 
	 * @param string $name The name of the property
	 */
	public function getProperty($name);
	/**
	 * Sets the property with the specifed name
	 * The storage will always call this function to set a property
	 *
	 * @param string $name
	 * @param mixed $value
	 */
	public function setProperty($name, $value);
	/**
	 * Returns true if this QIData object is a scalar value
	 *
	 * @return boolean
	 */
	public function isValue();
	/**
	 * If it returns true it means that the object has chaged and it can be saved in the database if needed
	 * If a property is specified then it should return if that property has changed
	 *
	 * @return boolean
	 */
	public function hasChanged($property = null);
}

?>